//
//  CeoZhuXCell.m
//  JinChengYun
//
//  Created by 金橙云 on 2017/4/18.
//  Copyright © 2017年 金橙云. All rights reserved.
//

//区域筛选
#define Start_X 66  // 第一个按钮的X坐标
#define Start_Y 2// 第一个按钮的Y坐标
#define Width_Space 3//2个按钮之间的横间距
#define Height_Space 2 // 竖间距
#define Button_Height 39 // 高
#define Button_Width (DAN_WIDTH-60-3*4)/3 // 宽


#define DAN_WIDTH  ([UIScreen mainScreen].bounds.size.width)
#import "CeoZhuXCell.h"

@implementation CeoZhuXCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        _oneLab = [[UILabel alloc] init];
        _oneLab.backgroundColor = [UIColor whiteColor];
        _oneLab.text = @"14";
        _oneLab.textAlignment = NSTextAlignmentCenter;
        _oneLab.font = [UIFont systemFontOfSize:12];
        [self addSubview:_oneLab];
        [_oneLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(60, 40));
            make.left.equalTo(self.mas_left).offset(2);
            make.top.equalTo(self.mas_top).offset(2);
            
        }];
        

        
        _houseArr = [[NSMutableArray alloc] init];
        _louArr = [[NSMutableArray alloc] init];

        

    }
    return self;
}

-(void)layoutSubviews
{
    for (int i = 0; i<_houseArr.count; i++)
    {
        NSInteger index = i % 3;
        NSInteger page = i / 3;
        
        
        
        // 圆角按钮
        _nBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
        _nBtn.backgroundColor = [UIColor whiteColor];
        _nBtn.frame = CGRectMake(index * (Button_Width + Width_Space) + Start_X, page  * (Button_Height + Height_Space)+Start_Y, Button_Width, Button_Height);

        [self addSubview:_nBtn];
        
        _louLab = [[UILabel alloc] init];
       // _louLab.text = @"2009";
        _louLab.text = _louArr[i][@"room_num_sale"];
        _louLab.textColor = [UIColor orangeColor];
        _louLab.textAlignment = NSTextAlignmentCenter;
        _louLab.font = [UIFont systemFontOfSize:10];
        [_nBtn addSubview:_louLab];
        [_louLab mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.size.mas_equalTo(CGSizeMake(60, 20));
                    make.top.equalTo(_nBtn.mas_top).offset(2);
                    make.centerX.equalTo(_nBtn.mas_centerX);
                }];
        
        _xiaLab = [[UILabel alloc] init];
        //_xiaLab.text = @"1234455";
        _xiaLab.text = _louArr[i][@"shenpi_price"];
        _xiaLab.textColor = [UIColor blackColor];
        _xiaLab.textAlignment = NSTextAlignmentCenter;
        _xiaLab.font = [UIFont systemFontOfSize:10];
        [_nBtn addSubview:_xiaLab];
        [_xiaLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(CGSizeMake(60, 20));
            make.top.equalTo(_nBtn.mas_bottom).offset(-20);
            make.centerX.equalTo(_nBtn.mas_centerX);
        }];



    }
    
    
}
-(void)setupCustomTableViewCellWIthBtnArr:(NSMutableArray *)_arr withShangLab:(NSMutableArray *)_shangArr withXiaLab:(NSString *)_xia
{
    _houseArr = _arr;
    _louArr = _shangArr;
//    _louLab.text = _shang;
//    _xiaLab.text = _xia;
    
    
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
